import java.util.Scanner;

public class Lesson4 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        // 输入a的值
        System.out.print("请输入a的值（1-9之间）: ");
        int a = scanner.nextInt();
        while (a < 1 || a > 9) {
            System.out.print("输入错误，请重新输入a的值（1-9之间）: ");
            a = scanner.nextInt();
        }

        // 输入项数
        System.out.print("请输入项数: ");
        int n = scanner.nextInt();

        // 计算并打印结果
        long sum = 0;
        long currentNumber = 0;

        for (int i = 1; i <= n; i++) {

            currentNumber = currentNumber * 10 + a;
            sum += currentNumber;
        }

        System.out.println("结果是: " + sum);
    }
}